home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 21 / Cream of the Crop 21 (Terry Blount) (October 1996).iso / program / libkb100.zip / LIBKB-1.00 / SAMPLES / MYCONIO.H < prev    next >
C/C++ Source or Header  |  1996-07-23  |  4KB  |  150 lines

  1. /* myconio.h -- include file used by 'libkb' test programs
  2.  * Copyright (C) 1995, 1996 Markus F.X.J. Oberhumer
  3.  * For conditions of distribution and use, see copyright notice in kb.h 
  4.  */
  5.  
  6. /* WARNING: this file should *not* be used by applications. It is
  7.    part of the implementation of the keyboard library and is
  8.    subject to change. Applications should only use kb.h.
  9.  */
  10.  
  11.  
  12. /***********************************************************************
  13. // portability wrapper for conio terminal stuff
  14. ************************************************************************/
  15.  
  16. #if defined(__WATCOMC__)
  17.  
  18. #include <graph.h>
  19.  
  20. #define _SOLIDCURSOR        0x0007
  21. #define _NORMALCURSOR        0x0607
  22. #define _NOCURSOR            0x2000
  23.  
  24. #define gotoxy(x,y)            _settextposition(y,x)
  25. #define cputs(x)            _outtext(x)
  26. #define clrscr()            _clearscreen(0)
  27. #define textcolor(x)        _settextcolor(x)
  28. #define _setcursortype(x)    _settextcursor(x)
  29.  
  30. #endif /* __WATCOMC__ */
  31.  
  32.  
  33.  
  34. #if defined(__EMX__)
  35.  
  36. #include <sys/video.h>
  37.  
  38. #define _SOLIDCURSOR        2
  39. #define _NORMALCURSOR        1
  40. #define _NOCURSOR            0
  41.  
  42. #define cinit()                v_init()
  43. #define gotoxy(x,y)            v_gotoxy((x)-1,(y)-1)
  44. #define cputs(x)            v_puts(x)
  45. #define clrscr()            v_clear()
  46. #define textcolor(x)        v_attrib((x) & 0xf)
  47. #define _setcursortype(x)    ((void)(x == _NOCURSOR && (v_hidecursor(),1)))
  48.  
  49. #endif /* __EMX__ */
  50.  
  51.  
  52.  
  53. #if defined(__KB_LINUX)
  54.  
  55. #include <curses.h>
  56.  
  57. #define _SOLIDCURSOR        2
  58. #define _NORMALCURSOR        1
  59. #define _NOCURSOR            0
  60.  
  61. #if defined(__NCURSES_H)
  62. #  define cinit()            (initscr(), start_color(), 0)
  63. #  define cexit()            (attrset(A_NORMAL), endwin())
  64. #  define textcolor(x)        attrset(x)
  65. #  define _setcursortype(x)    curs_set(x)
  66. #  define cputsa(x,len)        (waddchnstr(stdscr,x,len), refresh())
  67. #else
  68. #  define cinit()            (initscr(), 0)
  69. #  define cexit()            endwin()
  70. #  define textcolor(x)        ((void)0)
  71. #  define _setcursortype(x)    ((void)0)
  72. #  define init_pair(a,b,c)    ((void)0)
  73. #endif
  74. #define gotoxy(x,y)            move((y)-1,(x)-1)
  75. #define cputs(x)            (addstr(x), refresh())
  76. #define clrscr()            (clear(), refresh())
  77.  
  78. #endif /* __KB_LINUX */
  79.  
  80.  
  81.  
  82. /***********************************************************************
  83. //
  84. ************************************************************************/
  85.  
  86. #if !defined(BLACK)
  87. #if defined(__WATCOMC__) || defined(__EMX__) || defined(__KB_LINUX)
  88.  
  89. #if defined(__NCURSES_H)
  90.  
  91. /* dark colors */
  92. #define BLACK             (COLOR_PAIR(COLOR_BLACK))
  93. #define BLUE              (COLOR_PAIR(COLOR_BLUE))
  94. #define GREEN             (COLOR_PAIR(COLOR_GREEN))
  95. #define CYAN              (COLOR_PAIR(COLOR_CYAN))
  96. #define RED               (COLOR_PAIR(COLOR_RED))
  97. #define MAGENTA           (COLOR_PAIR(COLOR_MAGENTA))
  98. #define BROWN             (COLOR_PAIR(COLOR_YELLOW))
  99. #define LIGHTGRAY         (COLOR_PAIR(COLOR_WHITE))
  100.  /* light colors */
  101. #define DARKGRAY          (COLOR_PAIR(COLOR_BLACK) | A_BOLD)
  102. #define LIGHTBLUE         (COLOR_PAIR(COLOR_BLUE) | A_BOLD)
  103. #define LIGHTGREEN        (COLOR_PAIR(COLOR_GREEN) | A_BOLD)
  104. #define LIGHTCYAN         (COLOR_PAIR(COLOR_CYAN) | A_BOLD)
  105. #define LIGHTRED          (COLOR_PAIR(COLOR_RED) | A_BOLD)
  106. #define LIGHTMAGENTA      (COLOR_PAIR(COLOR_MAGENTA) | A_BOLD)
  107. #define YELLOW            (COLOR_PAIR(COLOR_YELLOW) | A_BOLD)
  108. #define WHITE             (COLOR_PAIR(COLOR_WHITE) | A_BOLD)
  109.  
  110. #else
  111.  
  112. enum {
  113.     BLACK,          /* dark colors */
  114.     BLUE,
  115.     GREEN,
  116.     CYAN,
  117.     RED,
  118.     MAGENTA,
  119.     BROWN,
  120.     LIGHTGRAY,
  121.     DARKGRAY,       /* light colors */
  122.     LIGHTBLUE,
  123.     LIGHTGREEN,
  124.     LIGHTCYAN,
  125.     LIGHTRED,
  126.     LIGHTMAGENTA,
  127.     YELLOW,
  128.     WHITE
  129. };
  130.  
  131. #endif
  132.  
  133. #endif
  134. #endif
  135.  
  136.  
  137. #ifndef cputsa
  138. #  define cputsa(x,len)        cputs(x)
  139. #endif
  140. #ifndef cbeep
  141. #  define cbeep()            ((void)(putchar('\a'), fflush(stdout)))
  142. #endif
  143. #ifndef cexit
  144. #  define cexit()            ((void)0)
  145. #endif
  146.  
  147. /*
  148. vi:ts=4
  149. */
  150.